import axios from "@/models/axios"
import type LeaveModel from "@/models/leaveInterFace"

export const addLeave = (data: LeaveModel) => {
    return axios({
        method: "post",
        url: "/api/leave/add",
        data,
        headers: {
            token: localStorage.getItem("token"),
        },
    })
}

export const leavelist = (data: any) => {
    return axios({
        method: "get",
        url: "/api/leave/list",
        params: data,
        headers: {
            token: localStorage.getItem("token"),
        },
    })
}
export const changetype = (info: any) => {//更新状态
    return axios({
        method: "get",
        url: "/api/leave/changetype",
        params: info,
        headers: {
            token: window.localStorage.getItem("token")
        }
    })
}
export const getGroupInfo = (params: any) => {
    return axios({
        method: "get",
        url: "/api/leave/group",
        params,
    })
}
export const upDate = (data: any) => {
    return axios({
        method: "patch",
        url: "/api/leaves/update",
        headers: {
            "token": window.localStorage.getItem("token")
        },
        data
    })
}